import HttpUtils from '../../utils/http.utils';

const urls = {
		'list': globalConfig.apiPath.v1 + 'api/auth/v1/authorities/roles',
		'delete': globalConfig.apiPath.v1 + 'api/auth/v1/authorities/roles/',
		'authlist': globalConfig.apiPath.v1 + 'api/auth/v1/authorities',
		'createrole': globalConfig.apiPath.v1 + 'api/auth/v1/authorities/roles',
		'roleinfo': globalConfig.apiPath.v1 + 'api/auth/v1/authorities/roles/',
		'updaterole': globalConfig.apiPath.v1 + 'api/auth/v1/authorities/roles/'
}

let RoleSrv = {

	list: function (params = {}) {
		return HttpUtils.get(urls.list,params);
	},
	deleteRole: function (params = {}) {
		return HttpUtils.delete(urls.delete + params.roleID);
	},
	getAuthList: function(params = {}){
		return HttpUtils.get(urls.authlist,params);
	},
	createRole: function(params = {}){
		return HttpUtils.post(urls.createrole,params);
	},
	getRoleInfo: function(params = {}){
		return HttpUtils.get(urls.roleinfo + params.roleID);
	},
	updateRole: function(params = {}){
		return HttpUtils.post(urls.roleinfo + params.roleID,params);
	}
};

export {RoleSrv};
